<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
        <h1>编辑学生</h1>
        <form method="post" action="/edit_students/?nid={{ result.student_id }}">
            <p>学生名称：<input type="text" name="title" value="{{ result.student_name }}" /></p>
            <p>
                    所属班级
                    <select name="class_id">
                        {% for row in students_list  %}
                            {% if row.id == result.class_id %}
                                <!-- 如果这里班级id等于当前编辑的班级id则替换到当前班级id所属的班级名字!-->
                                 <option selected value="{{ row.id }}">{{ row.title }}</option>
                            {% else %}
                                <option value="{{ row.id }}">{{ row.title }}</option>
                            {% endif %}
                        {% endfor %}
                    </select>
                </p>
            <input type="submit" value="提交" />
        </form>
</body>
</html>